package com.debao;

import com.debao.common.core.domain.AjaxResult;
import com.debao.common.utils.SecurityUtils;
import com.debao.system.domain.StadiumTableSchedule;
import com.debao.system.service.IStadiumTableScheduleService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RequestMapping("/api/stadiumTableSchedule")
@RestController
@CrossOrigin
public class ApiStadiumTableSchedule {


    @Resource
    private IStadiumTableScheduleService stadiumTableScheduleService;

    /**
     * 获取我的场馆排期
     */
    @GetMapping("/list")
    public AjaxResult list(StadiumTableSchedule stadiumTableSchedule) {
        stadiumTableSchedule.setAppointUserId(SecurityUtils.getUserId());
        return AjaxResult.success(stadiumTableScheduleService.selectStadiumTableScheduleList(stadiumTableSchedule));
    }


    /**
     * 获取我的预约
     */
    @GetMapping("/appointList")
    public AjaxResult appointList() {
        Long userId = SecurityUtils.getUserId();
        return AjaxResult.success(stadiumTableScheduleService.selectStadiumTableScheduleGroupList(new StadiumTableSchedule()
                .setAppointUserId(userId)
                .setUsable(0)));
    }
}
